#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define BEGINS(x) namespace x {
#define ENDS(x) } // end of namespace x

BEGINS(test1)

class UNCOPYABLE { // 功能类
public:
    UNCOPYABLE(const UNCOPYABLE &) = delete;
    UNCOPYABLE &operator=(const UNCOPYABLE &) = delete;
    UNCOPYABLE &operator=(const UNCOPYABLE &) const = delete;

protected:
    UNCOPYABLE() = default;
};

class A : public UNCOPYABLE {

};

int main() {
    A a;
    A b;
//    A b(a); // no, copy constructor delete
//    b = a; // no, operator= delete

    return 0;
}

ENDS(test1)

BEGINS(test2)

class HAS_XY {
public:
    int x, y;
};

class HAS_XYZ : public HAS_XY {
public:
    int z;
};

class A : public HAS_XY {
public:
    A() { x = y = 1; }
};
class B : public HAS_XY {
public:
    B() { x = y = 2; }
};
class C : public HAS_XYZ {
public:
    C() { x = y = z = 3; }
};
class D : public HAS_XY {
public:
    D() { x = y = 4; }
};
class E : public HAS_XYZ {
public:
    E() { x = y = z = 5; }
};

void func(HAS_XY &a) {
    cout << "has xy : ";
    cout << a.x << ", " << a.y << endl;
    return ;
}
void func(HAS_XYZ &a) {
    cout << "has xyz: ";
    cout << a.x << ", " << a.y << ", " << a.z << endl;
    return ;
}

int main() {
    // 标记每一种类的性质
    // 重载可以针对处理每种性质的类
    A a;
    B b;
    C c;
    D d;
    E e;
    func(a), func(b), func(c), func(d), func(e);

    return 0;
}

ENDS(test2)

int main() {
    test2::main();

    return 0;
}